// Squall Sound
// (c) jimon game studio

#include "CSound_Squall.h"

#ifdef JE_SOUND_SQUALL

#include "squall.h"

namespace je
{
	namespace sound
	{
		//! Constructor
		CSound_Squall::CSound_Squall(s32 SoundId)
			:Sound(SoundId),Channel(0)
		{
			Channel = SQUALL_Sample_Play(Sound,0,0,false);
		}

		//! Destructor
		CSound_Squall::~CSound_Squall()
		{
			SQUALL_Sample_Unload(Sound);
		}

		//! Play
		void CSound_Squall::Play()
		{
			SQUALL_Channel_Start(Channel);
		}

		//! Stop
		void CSound_Squall::Stop()
		{
			SQUALL_Channel_Stop(Channel);
		}

		//! Pause
		void CSound_Squall::Pause(u1 Enable)
		{
			SQUALL_Channel_Pause(Channel,Enable);
		}

		//! Is Playing
		u1 CSound_Squall::IsPlaying()
		{
			return (SQUALL_Channel_Status(Channel) == SQUALL_CHANNEL_STATUS_PLAY);
		}

		//! Set Looped
		void CSound_Squall::SetLooped(u1 Looped)
		{
			SQUALL_Channel_SetLoop(Channel,Looped);
		}

		//! Is Looped
		u1 CSound_Squall::IsLooped()
		{
			return SQUALL_Channel_GetLoop(Channel) ? true : false;
		}

		//! Set Volume
		void CSound_Squall::SetVolume(s32 Volume)
		{
			SQUALL_Channel_SetVolume(Channel,Volume);
		}

		//! Get Volume
		s32 CSound_Squall::GetVolume()
		{
			return SQUALL_Channel_GetVolume(Channel);
		}
	}
}

#endif
